<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>测试js回调函数</title>
    <script src="../zujian/han/han.js"></script>
</head>
<body>

<script type="text/javascript">
    function  a(callback){
        console.log("a函数打印");
        callback.call(this);//或者是 callback（）,  callback.apply(this),看个人喜好
    }
    function  b(){
        console.log("b函数打印");
    }
    //回调//先打印a再打印b
    a(b);
///////////////////////////////
    function  a1(callback){
        sleephan(100)
            console.log("a1函数打印");
        callback.call(this);
    }
    function  b1(){
        console.log("b1函数打印");
    }
    //回调//先打印a1再打印b1,
    a1(b1);
/////////////////////////////////////
     function  a2(callback){
            console.log("a2函数打印");
         callback.call(this,'d');
    }
    function  b2(param){
        console.log("b2函数打印");
        console.log(param)
    }
    //打印b2//再打印a2//再打印d
    a2(b2)

///////////////////////////////////////////////////

    function  a3(){
         sleephan(100)
         console.log("a3函数打印");
    }
    function  b3(){
        console.log("b3函数打印");
    }

     function c3(){
         a3();
         b3();
    }
    //打印a3  //b3
    c3();
</script>
</body>
</html>